if __name__ == '__main__':
    n = 99
    number = 1
    current_count = 0
    while current_count != n:
        if (number % 7 == 0) or (number % 10 == 7):
            pass
        else:
            current_count = current_count + 1
        number = number + 1
    print(number)